﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Entity.Calculator;

namespace TestsMyShop.Calculator_Tests
{
    [TestFixture]
    public class When_divide_two_values
    {
        private ICalculator calc;

        [SetUp]
        public void Init()
        {
            calc = new Calculator();
        }

        [Test]
        [TestCase(1, 2)]
        [TestCase(3, 5)]
        [TestCase(4, 6)]
        [TestCase(3, 7)]
        public void Should_devide_one_value_to_another_value(decimal numberOne, decimal numberTwo)
        {
            // act
            var actualValue = calc.Divide(numberOne, numberTwo);

            // assert
            Assert.AreEqual(numberOne / numberTwo, actualValue);
        }

        [Test]
        [TestCase(1, 0)]
        [TestCase(3, 0)]
        [TestCase(4, 0)]
        [TestCase(0, 0)]
        [TestCase(3, 0)]
        public void Should_throw_division_by_zero_exception_if_number_two_is_zero(decimal numberOne, decimal numberTwo)
        {
            // act
            var actualValue = new TestDelegate(() => calc.Divide(numberOne, numberTwo));

            // assert
            Assert.Throws<DivideByZeroException>(actualValue);
        }
    }
}
